
package cn.by.wms.controller;
import cn.by.wms.entity.Category;
import cn.by.wms.entity.Roles;
import cn.by.wms.entity.UserRole;
import cn.by.wms.service.UserRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

//Restful Api
@RestController
@RequestMapping("/api/userRole")
@Slf4j
public class UserRoleController {

    @Autowired
    private UserRoleService  userRoleService;


    @GetMapping
    public List<Roles> selectRole(Roles roles ) {
        return userRoleService.selectRole( roles);
    }

    @PostMapping("/addRole")
    public Integer insert(@RequestBody UserRole userRole){
        return userRoleService.insert(userRole);
    }

//    @PutMapping
//    public Integer update(@RequestBody Category product){
//        return categoryService.update(product);
//    }
//


    @PostMapping("/deleteRole")
    public Integer delete(@RequestBody UserRole userRole){
        return userRoleService.delete(userRole);

    }



}
